import { http } from '@/utils/axios/init'

// 付款登记、经费入账相同前缀
const prefix = '/ctms/Rest/projectPayment/registration'

// 项目中心-付款登记列表查询
export function getRegistrationList(params) {
  return http.request({
    url: `${prefix}/list`,
    method: 'get',
    params
  })
}

// 项目中心-付款登记头部信息查询
export function getHeaderInfo(params) {
  return http.request({
    url: `${prefix}/getHeaderInfo`,
    method: 'get',
    params
  })
}

// 项目中心-付款登记-获取表单及文件清单
export function getFormAndFileList(params) {
  return http.request({
    url: `${prefix}/getFormAndFileList`,
    method: 'get',
    params
  })
}

// 项目中心-付款登记-删除
export function deleteRegistration(params) {
  return http.request(
    {
      url: `${prefix}/delete`,
      method: 'post',
      params
    },
    {
      successMessageText: '删除成功'
    }
  )
}

// 项目中心-付款登记-撤回
export function workflowOperateProcess(params) {
  return http.request(
    {
      url: `${prefix}/workflowOperateProcess`,
      method: 'post',
      params
    },
    {
      successMessageText: '操作成功'
    }
  )
}

// 项目中心-付款登记-根据付款登记id获取金额
export function getAmountBypaymentRegistId(params) {
  return http.request({
    url: `${prefix}/getAmountBypaymentRegistId`,
    method: 'get',
    params
  })
}

// 项目中心-付款登记-根据项目id和合同类型获取费用类型
export function getAmountTypeList(params) {
  return http.request({
    url: `/ctms/Rest/commonFinance/getFeeTypeByParam`,
    method: 'get',
    params
  })
}

// 项目中心-付款登记-暂存表单
export function presaveForm(params) {
  return http.request({
    url: `${prefix}/presaveForm`,
    method: 'post',
    params
  })
}
// 项目中心-付款登记-暂存明细
export function presaveDetail(params) {
  return http.request({
    url: `${prefix}/presaveDetail`,
    method: 'post',
    params
  })
}
// 项目中心-付款登记-暂存文件清单
export function presaveFileList(params) {
  return http.request({
    url: `${prefix}/presaveFileList`,
    method: 'post',
    params
  })
}

// 项目中心-付款登记-提交
export function registerSubmit(params) {
  return http.request({
    url: `${prefix}/submit`,
    method: 'post',
    params
  })
}

// 项目中心-付款登记-获取表单列表
export function getformList(params) {
  return http.request({
    url: `/common/Rest/form/apply/list`,
    method: 'get',
    params
  })
}
// 项目中心-付款登记-获取表单详情
export function getformDetail(params) {
  return http.request({
    url: `/common/Rest/form/apply/detail`,
    method: 'get',
    params
  })
}
// 项目中心-付款登记-获取费用明细
export function getCostDetail(params) {
  return http.request({
    url: `${prefix}/getDetail`,
    method: 'get',
    params
  })
}
// 项目中心-付款登记-获取文件清单数据
export function getfileDetailList(params) {
  return http.request({
    url: `/ctms/Rest/projectFileListItem/commonDetailList`,
    method: 'get',
    params
  })
}

// /ctms/Rest/projectFileListItem/detailList

// 组织中心-经费入账-列表查询
export function orglist(params) {
  return http.request({
    url: `${prefix}/orglist`,
    method: 'get',
    params
  })
}

// 组织中心-经费入账-导出
export function orgExportList(params) {
  return http.request(
    {
      url: `${prefix}/orgExportList`,
      method: 'get',
      params,
      responseType: 'blob',
      headers: {
        'yootrial-account': 0,
        'yootrial-app': 0,
        'yootrial-signature': 0,
        'yootrial-timestamp': Date.now()
      }
    },
    {
      isReturnNativeResponse: true
    }
  )
}

// 组织中心-经费入账-设为已开票
export function makeInvoice(params) {
  return http.request(
    {
      url: `${prefix}/makeInvoice`,
      method: 'post',
      params
    },
    {
      successMessageText: '操作成功'
    }
  )
}

// 组织中心-经费入账-设为已领票
export function receiveInvoice(params) {
  return http.request(
    {
      url: `${prefix}/receiveInvoice`,
      method: 'post',
      params
    },
    {
      successMessageText: '操作成功'
    }
  )
}

// 组织中心-经费入账-发送领票提醒
export function sendReceiveRemind(params) {
  return http.request(
    {
      url: `${prefix}/sendReceiveRemind`,
      method: 'post',
      params
    },
    {
      successMessageText: '已成功发送消息提醒'
    }
  )
}

// 项目中心-付款登记-付款登记信息详情
export function getPaymentRegister(params) {
  return http.request({
    url: `${prefix}/getPaymentRegister`,
    method: 'get',
    params
  })
}
